<?php
namespace Api\Controller;
use Think\Controller;
class IndexController extends Controller {
    /**
	 * @api {get} /api/stu/one&sid=用户编号 获取一个用户
	 * @apiSampleRequest /api/user/one
	 * @apiPermission 无
	 * @apiName one
	 * @apiGroup stu
	 * @apiVersion 1.0.0
	 * @apiDescription   api   获取一个用户
	 *
	 * @apiParam {Number} sid  学生编号    (必填).
	 *
	 * @apiSuccessExample Success-Response:
	 *     HTTP/1.1 200 OK
	 *     {
	 *       "valid": 1,
	 *       "data": [
	 *           {
	 *              "sid: "学生编号",
	 *              "username": "学生名称",
	 *           }
	 *       ]
	 *     }
	 *
	 *
	 * @apiErrorExample Error-Response:
	 *     HTTP/1.1 404 Not Found
	 *      {
	 *          "valid": 0,
	 *          "message":"错误信息"
	 *      }
	 */
	public function one() {
		$data = M( 'stu' )->where('sid=$d',I('get.sid'))->find();
		$this->ajaxReturn( [ 'code' => 0, 'data' => $data ] );
	}
}